# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-pmezard-go-difflib
pkgver=1.0.0
pkgrel=2
pkgdesc='Partial port of Python difflib package to Go'
arch=('any')
url="https://github.com/pmezard/go-difflib"
license=('BSD')
depends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/pmezard/go-difflib/archive/v$pkgver.tar.gz")
sha512sums=('283927de73a3d0405bbca8b5b0c24137dde2f1063539c6ce4437331ed99e732175b2a384e5a70cb9a87cc74da94f5347e2a9785fbf3e46ec2431dc5071c3f045')

check() {
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/pmezard
  cp -a "$srcdir"/go-difflib-$pkgver "$srcdir"/build/src/github.com/pmezard/go-difflib
  cd "$srcdir"/build/src/github.com/pmezard/go-difflib
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/pmezard
  cp -a "$srcdir"/go-difflib-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/pmezard/go-difflib

  install -Dm644 go-difflib-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
